package com.woniuxy.educationplatform.configuration;

import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author unreleased
 * @date 2020/12/7 17:25
 */
@Configuration
public class SpringMvcConfiguration implements WebMvcConfigurer {
    /**
     * 配置页面跳转控制器
     * @param registry
     */
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("html/user/login");
        registry.addViewController("/login").setViewName("html/user/login");
        registry.addViewController("/index").setViewName("html/index");
        registry.addViewController("/home/console").setViewName("html/user/show");
        registry.addViewController("/order/order").setViewName("html/order/order");
        registry.addViewController("/order/orderDetail").setViewName("html/order/orderDetail");
        registry.addViewController("/user/administrators/list").setViewName("html/user/administrators/list");
        registry.addViewController("/user/administrators/role").setViewName("html/user/administrators/role");
        registry.addViewController("/set/user/info").setViewName("html/set/user/info");
        registry.addViewController("/set/user/password").setViewName("html/set/user/password");
        registry.addViewController("/user/admin").setViewName("html/user/admin");
        registry.addViewController("/user/role").setViewName("html/user/role");
        registry.addViewController("/unauthorized").setViewName("html/unauthorized");
        registry.addViewController("/404").setViewName("html/errorpage/404");
        registry.addViewController("/500").setViewName("html/errorpage/500");

        /*...*/
        registry.addViewController("/goods/goodsInfo").setViewName("html/goods/goodsInfo");
        registry.addViewController("/goods/addPage").setViewName("html/goods/addPage");
        registry.addViewController("/goods/setcol").setViewName("html/goods/setColumn");
        registry.addViewController("/goods/enti").setViewName("html/goods/entity");
        registry.addViewController("/goods/colu").setViewName("html/goods/column");

        //老谢的页面跳转控制器
        registry.addViewController("/project").setViewName("html/content/project");
        registry.addViewController("/course").setViewName("html/content/course");
        registry.addViewController("/live").setViewName("html/content/live");
        registry.addViewController("/video").setViewName("html/content/video");
        registry.addViewController("/upload").setViewName("html/content/maxFileUpload");
        registry.addViewController("/knowpoint").setViewName("html/content/knowpoint");


        //下面的视图控制器由“赵扬”创建并使用
        registry.addViewController("/sms").setViewName("html/message/sms");
        registry.addViewController("/smsmanage").setViewName("html/message/smsmanage");

        //下面的视图控制器由“朱芷莹”创建并使用
        registry.addViewController("/student/record").setViewName("html/student/record");
        registry.addViewController("/student/studentinfo").setViewName("html/student/studentInfo");
        registry.addViewController("/student/studentinclass").setViewName("html/student/classInfo");
        registry.addViewController("/student/studentdetail").setViewName("html/student/studentDetail");
        //下面的视图控制器由“杨欢”创建并使用
        registry.addViewController("/ques/question").setViewName("html/ques/question");
        registry.addViewController("/ques/test").setViewName("html/ques/test");
        registry.addViewController("/ques/add").setViewName("html/ques/add");
        registry.addViewController("/ques/classtest").setViewName("html/quesBank/classtest");
        registry.addViewController("/ques/quesbank").setViewName("html/quesBank/quesbank");
        registry.addViewController("/ques/relques").setViewName("html/ques/relques");


        //下面的视图控制器由“景浩”创建并使用
        registry.addViewController("/teacher/teacher").setViewName("html/teacher/teacher");
        registry.addViewController("/teacher/addTeacher").setViewName("html/teacher/addTeacher");
        registry.addViewController("/teacher/updateTeacher").setViewName("html/teacher/updateTeacher");

        //将该注册器 设置SpringMVC框架的最高权限
        registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
    }
}
